<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>石头剪刀布</title>
</head>
<body>
玩家:<img id="wj" src="../../image/石头.png"><br>
电脑;<img id="dn" src="../../image/布.png"><br>
<script>
    var cc= window.prompt("请出拳【0-剪刀 1-石头 2-布】");
    var dn= parseInt(Math.random()*3);
    if (cc==0){
        var wj=document.getElementById("wj");
        wj.src="../image/剪刀.png";
        if (dn == 0) {
            alert("平局");
            var dn= document.getElementById("dn");
            dn.src="../image/剪刀.png";
        }else if (dn == 1) {
            alert("电脑胜");
            var dn= document.getElementById("dn");
            dn.src="../image/石头.png";
        }else if (dn == 2) {
            alert("玩家胜");
            var dn= document.getElementById("dn");
            dn.src="../image/布.png";
        }
    } else if (cc==1){
        var wj=document.getElementById("wj");
        wj.src="../image/石头.png";
        if (dn == 0) {
            alert("玩家胜");
            var dn= document.getElementById("dn");
            dn.src="../image/剪刀.png";
        }else if (dn == 1) {
            alert("平局");
            var dn= document.getElementById("dn");
            dn.src="../image/石头.png";
        }else if (dn == 2) {
            alert("电脑胜");
            var dn= document.getElementById("dn");
            dn.src="../image/布.png";
        }
    } else if (cc==2) {
        var wj = document.getElementById("wj");
        wj.src = "../image/布.png";
        if (dn == 0) {
            alert("电脑胜");
            var dn = document.getElementById("dn");
            dn.src = "../image/剪刀.png";
        } else if (dn == 1) {
            alert("玩家胜");
            var dn = document.getElementById("dn");
            dn.src = "../image/石头.png";
        } else if (dn == 2) {
            alert("平局");
            var dn = document.getElementById("dn");
            dn.src = "../image/布.png";
        }
    }

</script>
</body>
</html>